package net.suncapper.wcss.web.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import net.suncapper.wcss.model.domain.WhitelistSetting;
import net.suncapper.wcss.model.dto.DeleteDTO;
import net.suncapper.wcss.model.dto.PageDTO;
import net.suncapper.wcss.model.vo.WhitelistSettingVO;
import org.springframework.web.bind.annotation.RequestMapping;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import net.suncapper.wcss.common.JsonResponse;
import net.suncapper.wcss.service.IBatchSettingService;
import net.suncapper.wcss.model.domain.BatchSetting;

import java.util.List;


/**
 *
 *  前端控制器
 *
 *
 * @author ztr
 * @since 2025-11-06
 * @version v1.0
 */
@RestController
@RequestMapping("/api/batchSetting")
public class BatchSettingController {

    private final Logger logger = LoggerFactory.getLogger( BatchSettingController.class );

    @Autowired
    private IBatchSettingService batchSettingService;
@GetMapping("getList")
    public JsonResponse<Page<BatchSetting>> getList(BatchSetting batchSetting, PageDTO pageDTO) {
    Page<BatchSetting> page=batchSettingService.pageList(batchSetting,pageDTO);
    System.out.println(JsonResponse.success(page));
    return JsonResponse.success(page);


}
    @PostMapping("adds")
    public JsonResponse addInsert(@RequestBody BatchSetting  bs)
    {
        Integer user=batchSettingService.insert(bs);
        return JsonResponse.success(user);
    }
    @PostMapping("delete")
    public JsonResponse deleted(@RequestBody BatchSetting  bs)
    {
        boolean b = batchSettingService.removeById(bs);
        return JsonResponse.success(b);
    }
    @GetMapping("getLists")
    public JsonResponse<Page<BatchSetting>> getLists(BatchSetting batchSetting, PageDTO pageDTO) {
        Page<BatchSetting> page=batchSettingService.pageLists(batchSetting,pageDTO);
        System.out.println(JsonResponse.success(page));
        return JsonResponse.success(page);
    }
    @PostMapping("deletes")
    public JsonResponse deleteds(@RequestBody DeleteDTO deleteDTO)
    {
        boolean b = batchSettingService.removeByIds(deleteDTO.getIds());
        return JsonResponse.success(b);
    }
    @PostMapping("update")
    public JsonResponse update(@RequestBody BatchSetting  bs)
    {
        boolean b= batchSettingService.updateById(bs);
        return JsonResponse.success(b);
    }
}

